package pl.lsierant.j2me.bipacz.util;

import java.util.Vector;

public class Util {
    // private static final Logger logger = new Logger("DeserializationHelper");

    public static Vector arrayToVector(Object[] array) {
        // logger.log("arrayToVector: size = ", array.length);
        Vector result = new Vector(array.length);
        for (int i = 0; i < array.length; i++) {
            // logger.log("arrayToVector: addElement = ", array[i]);
            result.addElement(array[i]);
        }
        // logger.log("arrayToVector: result size = ", result.size());
        return result;
    }

    public static String vectorToString(Vector v) {
        StringBuffer str = new StringBuffer();
        str.append("Vector: ");
        if (v == null) {
            str.append("null");
            return str.toString();
        }
        str.append("[");
        for (int i = 0; i < v.size(); i++) {
            Object element = v.elementAt(i);
            str.append(element != null ? element.toString() : "null");
        }
        str.append("]");
        return str.toString();

    }
}
